快速選單提供一系列選項讓使用者選取,選項可以是文字、位址、日期等。
這項使用的選項多為文字,最多可以提供是13個快速選單的選項。
elif mtext == '@確診證明申辦':
try:
message = TextSendMessage(
text='請點選想要了解申請的證明~',
quick_reply=QuickReply(
items=[
QuickReplyButton(
action=MessageAction(label="自主回報系統", text="自主回報系統")
),
QuickReplyButton(
action=MessageAction(label="領取快篩試劑", text="領取快篩試劑")
),
QuickReplyButton(
action=MessageAction(label="健康存摺_截圖", text="健康存摺_截圖")
),
QuickReplyButton(
action=MessageAction(label="數位健康證明", text="數位健康證明")
),
QuickReplyButton(
action=MessageAction(label="隔離通知書", text="隔離通知書")
),
QuickReplyButton(
action=MessageAction(label="勞保普通傷病給付", text="勞保普通傷病給付")
),
]
)
)
line_bot_api.reply_message(event.reply_token, message)
except:
line_bot_api.reply_message(event.reply_token,
TextSendMessage(text= 'Sorry~屁桃故障囉!'))
在上面程式碼中,label = “顯示值” >> 表示快速選單中出現的文字。text= “選取值” >> 表示使用者點取 快速選單回傳的文字。通常會將顯示及與選取直設為相同的文字。
當使用者在點選其快速選單時, 輸出快速選單相對文字的回應(文字, 圖片, 貼圖...); 該動作程式如下圖:
elif mtext == '自主回報系統':
try:
message = [
TextSendMessage(
text = "線上看完西醫門診, 醫生幫忙完成確診通報後, 就會傳送 “自主回報系統網站 ” 連結與相關資訊至確診者的手機簡訊中 (如圖)"
),
ImageSendMessage(
original_content_url = "https://ithelp.ithome.com.tw/upload/images/20220927/20151681meWeZe8gCP.png",
preview_image_url = "https://ithelp.ithome.com.tw/upload/images/20220927/20151681meWeZe8gCP.png"
)]
line_bot_api.reply_message(event.reply_token, message)
except:
line_bot_api.reply_message(event.reply_token,
TextSendMessage(text= 'Sorry~屁桃故障囉!'))
elif mtext == '領取快篩試劑':
try:
message = [
TextSendMessage(
text = "填寫簡訊連結- 確診者/接觸者 可領取 *快篩試劑* : 填寫完 *自主回報系統* 連結, 會傳送 *確診者/接觸者* 可領取 *快篩試劑* 連結的簡訊 (如下圖)"
),
ImageSendMessage(
original_content_url = "https://ithelp.ithome.com.tw/upload/images/20220926/20151681XKRDF8tO6X.jpg",
preview_image_url = "https://ithelp.ithome.com.tw/upload/images/20220926/20151681XKRDF8tO6X.jpg"
)]
line_bot_api.reply_message(event.reply_token, message)
except:
line_bot_api.reply_message(event.reply_token,
TextSendMessage(text= 'Sorry~屁桃故障囉!'))
elif mtext == '健康存摺_截圖':
try:
message = [
TextSendMessage(
text = "申請 *健康存摺(截圖)* : \n \n Step 1. 下載 *全民健保行動快易通* 或 *健康存摺* ~ \n \n Step2. 健康存摺 所需截圖之流程 (如下圖): \n \n Step3. 線上Line 看診所需截圖 (身分證字號旁的眼睛記得點開,不要隱藏):"
),
ImageSendMessage(
original_content_url = "https://ithelp.ithome.com.tw/upload/images/20220926/20151681znRVs0MvIQ.jpg",
preview_image_url = "https://ithelp.ithome.com.tw/upload/images/20220926/20151681znRVs0MvIQ.jpg"
),
ImageSendMessage(
original_content_url = "https://ithelp.ithome.com.tw/upload/images/20220926/2015168178TbeQd8zh.jpg",
preview_image_url = "https://ithelp.ithome.com.tw/upload/images/20220926/2015168178TbeQd8zh.jpg"
),
ImageSendMessage(
original_content_url = "https://ithelp.ithome.com.tw/upload/images/20220926/20151681Y9DntKO9uW.jpg",
preview_image_url = "https://ithelp.ithome.com.tw/upload/images/20220926/20151681Y9DntKO9uW.jpg"
),
ImageSendMessage(
original_content_url = "https://ithelp.ithome.com.tw/upload/images/20220926/20151681uNUhdUpQXc.jpg",
preview_image_url = "https://ithelp.ithome.com.tw/upload/images/20220926/20151681uNUhdUpQXc.jpg"
)]
line_bot_api.reply_message(event.reply_token, message)
except:
line_bot_api.reply_message(event.reply_token,
TextSendMessage(text = 'Sorry~屁桃故障囉!'))
elif mtext == '數位健康證明':
try:
message = [
TextSendMessage(
text = "申請 *數位健康證明* : \n \n 數位健康證明申請流程 & 證明範例 (如下圖): \n \n 若無法掃描QR code 可以點選此連結: https://dvc.mohw.gov.tw/vapa/apply/Index.init.ctr?openExternalBrowser=1"
),
ImageSendMessage(
original_content_url = "https://ithelp.ithome.com.tw/upload/images/20220926/20151681zfmIEbwkRM.jpg",
preview_image_url = "https://ithelp.ithome.com.tw/upload/images/20220926/20151681zfmIEbwkRM.jpg"
),
ImageSendMessage(
original_content_url="https://ithelp.ithome.com.tw/upload/images/20220926/201516813FVmFyEzPy.jpg",
preview_image_url="https://ithelp.ithome.com.tw/upload/images/20220926/201516813FVmFyEzPy.jpg"
)]
line_bot_api.reply_message(event.reply_token, message)
except:
line_bot_api.reply_message(event.reply_token,
TextSendMessage(text= 'Sorry~屁桃故障囉!'))
elif mtext == '隔離通知書':
try:
message = [
TextSendMessage(
text = "申請 *確診者指定處所隔離通知書* : Step 1. *確診者指定處所隔離通知書* (如下圖)>>> 填寫完畢, 會傳送 *隔離書* 連結的簡訊 (如下圖)"
),
ImageSendMessage(
original_content_url = "https://ithelp.ithome.com.tw/upload/images/20220926/20151681CQyP7RyYan.jpg",
preview_image_url = "https://ithelp.ithome.com.tw/upload/images/20220926/20151681CQyP7RyYan.jpg"
),
ImageSendMessage(
original_content_url="https://ithelp.ithome.com.tw/upload/images/20220926/20151681QHSOv0GE2Y.jpg",
preview_image_url="https://ithelp.ithome.com.tw/upload/images/20220926/20151681QHSOv0GE2Y.jpg"
),
TextSendMessage(
text="Step2.確診者指定處所隔離通知書 - 示意圖如下:"
),
ImageSendMessage(
original_content_url="https://ithelp.ithome.com.tw/upload/images/20220926/201516816xK5hWDrUq.jpg",
preview_image_url="https://ithelp.ithome.com.tw/upload/images/20220926/201516816xK5hWDrUq.jpg"
)]
line_bot_api.reply_message(event.reply_token, message)
except:
line_bot_api.reply_message(event.reply_token,
TextSendMessage(text= 'Sorry~屁桃故障囉!'))
elif mtext == '勞保普通傷病給付':
try:
message = [
TextSendMessage(
text = "確診者或照顧者可線上申請 *勞保普通傷病給付* : \n \n 需準備 *自然人憑證* 或 *健保卡 and 戶號* 在勞保局e化服務系統(請點選此連結https://www.bli.gov.tw/0107197.html ), 進行線上申辦,只要填寫確診日期、申請不能工作期間、取得薪資情形、收治處所、帳戶及個人通訊資料等,無須提供確診診斷書或隔離通知書給勞保局,完成個人申辦後,經由所屬投保單位進行線上確認,即可完成申請手續"
)]
line_bot_api.reply_message(event.reply_token, message)
except:
line_bot_api.reply_message(event.reply_token,
TextSendMessage(text= 'Sorry~屁桃故障囉!'))
當使用者點選快速選單時, 會回傳該指令(文字) 想要回傳的結果~ 如下圖
在程式中,message = [ 要傳送的檔案類型A(檔案類型A = “”), 要傳送的檔案類型B(檔案類型B = “”), 要傳送的檔案類型C(檔案類型C = “”), ….)] 回傳的類型動作不能超過5 個~(屁桃 debug , try and error 的甘苦談...)
另外 QuickReplyButton(action=MessageAction(label="隔離通知書", text="隔離通知書"))
快速選單的設置數量不能超過13 個喔!